package cn.iocoder.yudao.boot.common.constant;

import cn.iocoder.yudao.boot.common.exception.ErrorCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
@AllArgsConstructor
public enum SystemErrorCode implements ErrorCode {
    BAD_REQUEST(HttpStatus.INTERNAL_SERVER_ERROR, "BadRequest", "请求参数不正确", BaseErrorCode.SYSTEM_ERROR),
    NOT_FOUND(HttpStatus.INTERNAL_SERVER_ERROR, "NotFound", "资源不存在", BaseErrorCode.SYSTEM_ERROR),
    METHOD_NOT_ALLOWED(HttpStatus.INTERNAL_SERVER_ERROR, "MethodNotAllowed", "请求方法不正确", BaseErrorCode.SYSTEM_ERROR),
    OUT_OF_MEMORY_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "OutOfMemoryError", "内存溢出错误", BaseErrorCode.SYSTEM_ERROR),
    // 磁盘空间不足错误的二级错误码
    DISK_SPACE_SHORTAGE(HttpStatus.INTERNAL_SERVER_ERROR, "DiskSpaceShortage", "磁盘空间不足错误", BaseErrorCode.SYSTEM_ERROR),
    // 数据库连接失败的二级错误码
    DATABASE_CONNECTION_FAILURE(HttpStatus.INTERNAL_SERVER_ERROR, "DatabaseConnectionFailure", "数据库连接失败", BaseErrorCode.SYSTEM_ERROR);;

    private HttpStatus httpStatus;
    private final String code;
    private final String msg;
    private final ErrorCode parent;
}
